/*
 * Created on Mar 29, 2004
 *
 * To change the template for this generated file go to
 * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
 */
package com.ba360.portal.categories;

import java.io.Reader;
import java.util.Collection;
import java.util.Iterator;

/**
 * @author ROnat
 * 
 * To change the template for this generated type comment go to
 * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
 */
public class CategoryList {

	public boolean hasSubCategory = false;

	private String categoryName;

	public String categoryNamePath;

	private CategoryList[] subCatList;

	private Reader contents;

	public boolean hasSubCategory(boolean subCat) {
		this.hasSubCategory = subCat;
		return hasSubCategory;
	}

	public void setCategoryName(String catName) {
		this.categoryName = catName;
	}

	public void setCategoryNamePath(String path) {
		this.categoryNamePath = path;
	}

	public String getCategoryName() {
		return categoryName;
	}

	public void populateSubCategory(Collection col) {

		Iterator iter = col.iterator();
		subCatList = new CategoryList[col.size()];
		int index = 0;
		while (iter.hasNext()) {
			CategoryList cl = new CategoryList();
			cl = (CategoryList) iter.next();
			subCatList[index] = cl;
			index = index + 1;
		}

	}

	public void setContents(Reader contents) {
		if (!hasSubCategory) {
			this.contents = contents;
		}
	}

	public Reader getContents() {
		return contents;
	}

	public CategoryList[] getSubCategoryList() {
		return subCatList;
	}

}